package com.liuhung.base.util;


public class UrlUtil {
	
	public final static String R_PATH=PropUtil.ROOT_UPLOAD_PATH;
	public final static String U_PATH=PropUtil.ROOT_UPLOAD_URL;
	/**
	 * 通过url获取文件真实路径
	 * @param urlPth
	 * @return
	 */
	public static String getRealPath(String urlPath)
	{
		return R_PATH+ urlPath.replace(U_PATH, "").replace("/", "\\"); 
	}
	/**
	 * 通过真实路径获取网络路径
	 * @param reahPath
	 * @return
	 */
	public static String getUrlPath(String realPath) {
		return U_PATH+realPath.replace(R_PATH, "").replace("\\", "/");
	}
	/**test
	public static void main(String[] args)  {
		String urlPath="/uploadres/img/2014091847/20140918113347_380.png";
		String realPath=UrlUtil.getRealPath(urlPath);
		System.out.println(urlPath);
		System.out.println(realPath);
		System.out.println(UrlUtil.getUrlPath(realPath));
	}
	**/
}
